$(function() {
    $("#js-login").on('submit', function() {
        var phone = $("#js-login").find('input[name="phone"]').val();
        var password = $("#js-login").find('input[name="password"]').val();
        $.ajax({
            'url': '/Ajax/Passport/login',
            data: {phone: phone, password: password},
            async:false,
            type: 'post',
            dataType: 'json',
            success: function (d) {
                if (d.error) {
                    alert(d.data)
                } else {
                    window.location.href = '/';
                }
            }
        });
        return false;
    });
});